Hệ thống hiệu sách thương mại điện tử
1 <?php
2 session_start();
3 if(!isset($_SESSION['user']))
4 header("location: index.php?Message=Login To Continue");
5 ?>
6
7 <!DOCTYPE html>
8 <html lang="en">
9 <head>
10
11 <meta charset="utf-8">
12 <meta http-equiv="X-UA-Compatible" content="IE=edge">
13 <meta name="viewport" content="width=device-width, initial-scale=1">
14 <meta name="description" content="Books">
15 <meta name="author" content="Shivangi Gupta">
16 <title> Online Bookstore</title>
17 <!-- Bootstrap -->
18 <link href="css/bootstrap.min.css" rel="stylesheet">
19 <link href="css/my.css" rel="stylesheet">
20
21 <style>
22 @media only screen and (width: 768px) { body{margin-top:150px;}}
23 @media only screen and (max-width: 760px) { #books .row{margin-top:10px;}}
24 .tag {display:inline;float:left;padding:2px 5px;width:auto;background:#F5A623;color:#fff;height:23px;}
25 .tag-side{display:inline;float:left;}
26 #books {border:1px solid #DEEAEE; margin-bottom:20px;padding-top:30px;padding-bottom:20px;background:#fff; margin-left:10%;margin-right:10%;}
27 #description {border:1px solid #DEEAEE; margin-bottom:20px;padding:20px 50px;background:#fff;margin-left:10%;margin-right:10%;}
28 #description hr{margin:auto;}
29 #service{background:#fff;padding:20px 10px;width:112%;margin-left:-6%;margin-right:-6%;}
30 .glyphicon {color:#D67B22;}
31 </style>
32
33 </head>
34 <body>
35 <nav class="navbar navbar-default navbar-fixed-top navbar-inverse">
36 <div class="container-fluid">
37 <!-- Brand and toggle get grouped for better mobile display -->
38 <div class="navbar-header">
39 <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
40 <span class="sr-only">Toggle navigation</span>
41 <span class="icon-bar"></span>
42 <span class="icon-bar"></span>
43 <span class="icon-bar"></span>
44 </button>
45 <a class="navbar-brand" href="index.php"><img alt="Brand" src="img/logo.jpg" style="width: 118px;margin-top: -7px;margin-left: -10px;"></a>
46 </div>
47
48 <!-- Collect the nav links, forms, and other content for toggling -->
49 <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
50 <ul class="nav navbar-nav navbar-right">
51 <?php
52 if(isset($_SESSION['user']))
53 {
54 echo'
55 <li><a href="cart.php" class="btn btn-md"><span class="glyphicon glyphicon-shopping-cart">Cart</span></a></li>
56 <li><a href="destroy.php" class="btn btn-md"> <span class="glyphicon glyphicon-log-out">LogOut</span></a></li>
57 ';
58 }
59 ?>
60 </ul>
61 </div><!-- /.navbar-collapse -->
62 </div><!-- /.container-fluid -->
63 </nav>
64
65 <div id="top" >
66 <div id="searchbox" class="container-fluid" style="width:112%;margin-left:-6%;margin-right:-6%;">
67 <div>
68 <form role="search" action="Result.php" method="post">
69 <input type="text" name="keyword" class="form-control" placeholder="Search for a Book , Author Or Category" style="width:80%;margin:20px 10% 20px 10%;">
70 </form>
71 </div>
72 </div>
73 </div>
74
75
76 <?php
77 include "dbconnect.php";
78 $PID=$_GET['ID'];
79 $query = "SELECT * FROM products WHERE PID='$PID'";
80 $result = mysqli_query ($con,$query)or die(mysql_error());
81
82 if(mysqli_num_rows($result) > 0)
83 {
84 while($row = mysqli_fetch_assoc($result))
85 {
86 $path="img/books/".$row['PID'].".jpg";
87 $target="cart.php?ID=".$PID."&";
88 echo '
89 <div class="container-fluid" id="books">
90 <div class="row">
91 <div class="col-sm-10 col-md-6">
92 <div class="tag">'.$row["Discount"].'%OFF</div>
93 <div class="tag-side"><img src="img/orange-flag.png">
94 </div>
95 <img class="center-block img-responsive" src="'.$path.'" height="550px" style="padding:20px;">
96 </div>
97 <div class="col-sm-10 col-md-4 col-md-offset-1">
98 <h2> '. $row["Title"] . '</h2>
99 <span style="color:#00B9F5;">
100 #'.$row["Author"].'    #'.$row["Publisher"].'
101 </span>
102 <hr>
103 <span style="font-weight:bold;"> Quantity : </span>';
104 echo'<select id="quantity">';
105 for($i=1;$i<=$row['Available'];$i++)
106 echo '<option value="'.$i.'">'.$i.'</option>';
107 echo ' </select>';
108 echo' <br><br><br>
109 <a id="buyLink" href="'.$target.'" class="btn btn-lg btn-danger" style="padding:15px;color:white;text-decoration:none;">
110 ADD TO CART for Rs '.$row["Price"] .' <br>
111 <span style="text-decoration:line-through;"> RS'.$row["MRP"].'</span>
112 | '.$row["Discount"].'% discount
113 </a>
114
115 </div>
116 </div>
117 </div>
118 ';
119 echo '
120 <div class="container-fluid" id="description">
121 <div class="row">
122 <h2> Description </h2>
123 <p>'.$row['Description'] .'</p>
124 <pre style="background:inherit;border:none;">
125 PRODUCT CODE '.$row["PID"].' <hr>
126 TITLE '.$row["Title"].' <hr>
127 AUTHOR '.$row["Author"].' <hr>
128 AVAILABLE '.$row["Available"].' <hr>
129 PUBLISHER '.$row["Publisher"].' <hr>
130 EDITION '.$row["Edition"].' <hr>
131 LANGUAGE '.$row["Language"].' <hr>
132 PAGES '.$row["page"].' <hr>
133 WEIGHT '.$row["weight"].' <hr>
134 </pre>
135 </div>
136 </div>
137 ';
138
139
140 }
141 }
142 echo '</div>';
143 ?>
144
145
146
147 <div class="container-fluid" id="service">
148 <div class="row">
149 <div class="col-sm-6 col-md-3 text-center">
150 <span class="glyphicon glyphicon-heart"></span> <br>
151 24X7 Care <br>
152 Happy to help 24X7, call us on 0120-3062244 or click here
153 </div>
154 <div class="col-sm-6 col-md-3 text-center">
155 <span class="glyphicon glyphicon-ok"></span> <br>
156 Trust <br>
157 Your money is yours! All refunds come with no question asked guarantee.
158 </div>
159 <div class="col-sm-6 col-md-3 text-center">
160 <span class="glyphicon glyphicon-check"></span> <br>
161 Assurance <br>
162 We provide 100% assurance. If you have any issue, your money is immediately refunded. Sit back and enjoy your shopping.
163 </div>
164 <div class="col-sm-6 col-md-3 text-center">
165 <span class="glyphicon glyphicon-tags"></span> <br>
166 24X7 Care <br>
167 Happiness is guaranteed. If we fall short of your expectations, give us a shout.
168 </div>
169 </div>
170 </div>
171
172
173
174 <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
175 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
176 <!-- Include all compiled plugins (below), or include individual files as needed -->
177 <script src="js/bootstrap.min.js"></script>
178 <script>
179 $(function () {
180 var link = $('#buyLink').attr('href');
181 $('#buyLink').attr('href', link + 'quantity=' + $('#quantity option:selected').val());
182 $('#quantity').on('change', function () {
183 $('#buyLink').attr('href', link + 'quantity=' + $('#quantity option:selected').val());
184 });
185 });
186 </script>
187 </body>
188 </html>